package net.pm.core.entities.db;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.fasterxml.jackson.annotation.JsonIgnore;

import net.pm.core.entities.PMCommandEntity;


/**
 * The persistent class for the material database table.
 * 物料
 */
@Entity
@Table(name="material")
public class Material extends PMCommandEntity<Material> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2519872079323051405L;
	private Long id;
	private Date addTime;
	private Integer inventoryNumber;
	private String materialName;
	private String materialNorms;
	private String materialUnit;
	private String remark;
	private List<Materiallog> logs;					//物料添加,领取日志
	@Transient
	@JsonIgnore
	public List<Materiallog> getLogs() {
		return logs;
	}
	public void setLogs(List<Materiallog> logs) {
		this.logs = logs;
	}
	
    public Material() {
    }


	public Material(Long id) {
		super();
		this.id = id;
	}


	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(unique=true, nullable=false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}


    @Temporal( TemporalType.TIMESTAMP)
	@Column(nullable=false)
	public Date getAddTime() {
		return this.addTime;
	}

	public void setAddTime(Date addTime) {
		this.addTime = addTime;
	}


	@Column(nullable=false)
	public int getInventoryNumber() {
		return this.inventoryNumber;
	}

	public void setInventoryNumber(int inventoryNumber) {
		this.inventoryNumber = inventoryNumber;
	}


	@Column(nullable=false, length=50)
	public String getMaterialName() {
		return this.materialName;
	}

	public void setMaterialName(String materialName) {
		this.materialName = materialName;
	}


	@Column(nullable=false, length=200)
	public String getMaterialNorms() {
		return this.materialNorms;
	}

	public void setMaterialNorms(String materialNorms) {
		this.materialNorms = materialNorms;
	}


	@Column(nullable=false, length=5)
	public String getMaterialUnit() {
		return this.materialUnit;
	}

	public void setMaterialUnit(String materialUnit) {
		this.materialUnit = materialUnit;
	}


	@Column(length=500)
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Override
	public int compareTo(Material o) {
		// TODO Auto-generated method stub
		return 0;
	}

}